package com.novunda.platform.entities;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.novunda.platform.entities.base.DataEntity;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.validator.constraints.Length;

import javax.persistence.*;

/**
 * @author yangg
 * @since 2016/9/12.
 */
@Entity
@Table(name = "sys_log")
@DynamicInsert
@DynamicUpdate
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
public class Log extends DataEntity {
    private static final long serialVersionUID = -7076985275975589290L;

    private long id;

    private String type;//日志类型

    private String name;//日志名称

    private String system;//系统

    private String ip;//操作IP

    private String result;//

    private String description;//描述

    private String userName;//操作者真实姓名

    private String loginName;//操作者登录名

    private String orgName;//机构名称

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    @Length(min = 1, max = 100)
    @Column(name = "type", length = 100)
    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    @Length(min = 1, max = 100)
    @Column(name = "name", length = 100)
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Length(min = 1, max = 100)
    @Column(name = "system", length = 100)
    public String getSystem() {
        return system;
    }

    public void setSystem(String system) {
        this.system = system;
    }

    @Length(min = 1, max = 100)
    @Column(name = "ip", length = 100)
    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    @Length(min = 1, max = 10)
    @Column(name = "result", length = 100)
    public String getResult() {
        return result;
    }

    public void setResult(String result) {
        this.result = result;
    }

    @Length(min = 1, max = 100)
    @Column(name = "description", length = 100)
    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }
    @Length(min = 1, max = 100)
    @Column(name = "user_name", length = 100)
    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }
    @Length(min = 1, max = 100)
    @Column(name = "login_name", length = 100)
    public String getLoginName() {
        return loginName;
    }

    public void setLoginName(String loginName) {
        this.loginName = loginName;
    }

    @Column(name = "org_name", length = 100)
    public String getOrgName() {
        return orgName;
    }

    public void setOrgName(String orgName) {
        this.orgName = orgName;
    }
}
